package com.itsc.service;

import java.util.List;

import com.itsc.dao.CenterPersonDao;
import com.itsc.entities.CenterPerson;
import com.itsc.service.inter.ICenterPersonService;
import com.itsc.util.page.Page;

public class CenterPersonService implements ICenterPersonService{

	private CenterPersonDao centerPersonDao;
	
	public void setCenterPersonDao(CenterPersonDao centerPersonDao) {
		this.centerPersonDao = centerPersonDao;
	}

	@Override
	public void save(CenterPerson centerPerson) {
		// TODO Auto-generated method stub
		centerPersonDao.save(centerPerson);
	}

	@Override
	public void delete(CenterPerson centerPerson) {
		// TODO Auto-generated method stub
		centerPersonDao.delete(centerPerson);
	}

	@Override
	public CenterPerson selectById(Integer id) {
		// TODO Auto-generated method stub
		String hql = "from CenterPerson where cp_id=?";
		CenterPerson centerPerson = centerPersonDao.selectById(hql, id);
		return centerPerson;
	}

	@Override
	public void update(CenterPerson centerPerson) {
		// TODO Auto-generated method stub
		centerPersonDao.update(centerPerson);
	}

	@Override
	public List<CenterPerson> selectAll() {
		// TODO Auto-generated method stub
		String hql = "from CenterPerson";
		List<CenterPerson> list = centerPersonDao.selectAll(hql);
		return list;
	}

	@Override
	public List<CenterPerson> getPage(Page page) {
		// TODO 自动生成的方法存根
		String hql = "from CenterPerson";
		return centerPersonDao.getPage(hql, page);
	}

	@Override
	public int getCount() {
		// TODO 自动生成的方法存根
		String hql = "select count(*) from CenterPerson";
		return centerPersonDao.getCount(hql);
	}

	@Override
	public int getCount(String searchname) {
		// TODO 自动生成的方法存根
		return centerPersonDao.search(searchname, null).size();
	}

	@Override
	public List<CenterPerson> search(String searchname, Page page) {
		// TODO 自动生成的方法存根
		return centerPersonDao.search(searchname, page);
	}
}
